import Ember from 'ember';
import BaseBusiness from '../base-business';
import Pagination from '../pagination';
const {leaveStatus1,leaveStatus2,leaveStatus3,consultStatus6,consultStatus7} = Constants;

export default BaseBusiness.extend(Pagination, {
    header_title: '员工列表',
    model() {
        return {};
    },
    doQuery: function() {//所有退住老人
        var _self = this;
        var params = this.buildQueryParams();
        var customerList = this.findPaged('customerbusinessflow', params, function(orgList) {});
        this.getCurrentController().set("customerList", customerList);
        console.log('doQuery1 orgList', customerList);
    },
    buildQueryParams: function() {
        var params = this.pagiParamsSet();
        var curController = this.getCurrentController();
        var filter =  {
            status:{typecode:Constants.consultStatus6}
        };
        if (curController) {
            if (curController.get('queryStayBack')) {
                filter = $.extend({}, filter, {
                    '[customer][name@$like]@$or1': curController.get('queryStayBack')
                });
                filter = $.extend({}, filter, {
                    '[customer][bed][name@$like]@$or1':curController.get('queryStayBack')
                });
            }
        }
        params.filter = filter;
        var sort = {
          'leaveDate': 'desc',
          '[leaveStatus][typecode]': 'asc'
        };
        params.sort = sort;
        console.log("params is:", params);
        return params;
    },
    saveRefresh: function() {
        this.refresh();
    },
    setupController:function(controller,model){
      this.doQuery();
    },
    actions:{
      searchStaff:function(){
        this.doQuery();
      },
    },
});
